// JavaScript Document


function check(type){
	class_name = (type == true) ? tr_on_check : tr_on_uncheck;
	for(i=start_loop; i<=end_loop; i++){
		try{
			document.getElementById("compare_check_" + i).checked = type;
			document.getElementById("tr_" + i).className = class_name;
		}
		catch(e){}
	}
}

function checkQuantity(){
	num = 0;
	for( i=start_loop; i<=end_loop; i++ ){
		try{
			if(document.getElementById("compare_check_" + i).checked == true){
				num++;
			}
		}
		catch(e){}
	}
	return num;
}


function addCommas(nStr)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + '.' + '$2');
	}
	return x1;
}
function formatCurrency(div_id,str_number){
	/*Convert tu 1000->1.000*/
	var mynumber=1000;	
	/*str_number = str_number.replace(/\./g,"");*/
	document.getElementById(div_id).innerHTML = addCommas(str_number);
}